/*
 * Group 3, User Interface Programming II (vt11)
 * Pooya | Flora | Monica | Can
 */
package vical.view;

import java.awt.*;
import javax.swing.*;
import vical.view.model.TimeLineModel;

/**
 * The TimeLineRuler for week view and day view
 * It is expected to display a time line for a single day
 * 
 * @author Can
 */
public class TimeLineRuler extends JComponent {

    private TimeLineModel timeLineModel;

    public TimeLineRuler(TimeLineModel timeLineModel) {
        this.timeLineModel = timeLineModel;
    }

    @Override
    protected void paintComponent(Graphics g) {
        Rectangle drawHere = g.getClipBounds();

        // Fill clipping area with dirty brown/orange.
        g.setColor(new Color(230, 163, 4));
        g.fillRect(drawHere.x, drawHere.y, drawHere.width, drawHere.height);

        // Font and Color
        g.setFont(new Font("SansSerif", Font.PLAIN, 10));
        g.setColor(Color.black);

        // ticks and labels
        for (int hour = 0; hour <= timeLineModel.getHours(); hour++) {
            g.drawString(Integer.toString(hour) + ":00", 
                    9, timeLineModel.getTimePositionY(hour));
        }
    }
}
